# frozen_string_literal: true

class ApplicationJob < ActiveJob::Base
  queue_as :new_batch

  def perform(number, coupon_params)
    1.upto(number.to_i) do |i|
      array = { code: Coupon.generate_code, show_index: i }
      new_params = coupon_params.merge!(array)
      coupon = Coupon.create!(new_params)
    end
  end
end
